SPB Git forge

spb/polyllm

Public
15commits 1branches 0releases
2.2 MBsize
maindefault branch
13 days agolast push
TypeScript 97.4% SQL 1% JavaScript 0.9% CSS 0.6%
711 B · 17 lines typescript
Raw Blame History
1import { withUser, json } from "@/lib/api";2import { probeEndpoint, getEndpoint } from "@/lib/endpoints/service";3import { LIMITS } from "@/lib/rate-limit";45export const dynamic = "force-dynamic";67type P = { id: string };89/** POST /api/endpoints/[id]/sync — discover models (`GET {baseUrl}{modelsPath}`) → `{ ok, models: PolyModel[], latencyMs, error?, endpoint }` */10export const POST = withUser<P>(11  async ({ user }, { id }) => {12    const r = await probeEndpoint(user.id, id);13    return json({ ok: r.ok, models: r.models, latencyMs: r.latencyMs, error: r.error, errorCode: r.errorCode, endpoint: await getEndpoint(user.id, id) });14  },15  { limit: { ...LIMITS.modelSync, key: "endpoint-sync" } },16);17